const express = require('express');
const db = require('../uilit/mysql')

const router=express.Router();


router.post('/login',function(req,res){
    const sql1=`SELECT* FROM seeker WHERE s_tel='${req.body.username}' AND s_password='${req.body.password}';`
    const sql2=`SELECT* FROM company WHERE s_tel='${req.body.username}' AND s_password='${req.body.password}';`
    if(Id==1){
        db.query(sql1,function(err,data){
            if(err){
                console.log(err)
            }else{
                if(data.length){
                    res.send('登录成功!')
                }else{
                    res.send('账号或密码不正确,请重新登录!')
                }
            }
        })
    }


    if(Id==2){
        db.query(sql2,function(err,data){
            if(err){
                console.log(err)
            }else{
                if(data.length){
                    res.send('登录成功!')
                }else{
                    res.send('账号或密码不正确,请重新登录!')
                }
            }
        })
    }
    
});


module.exports=router;